package com.yanyilu.qiubite.jpa;

import com.yanyilu.qiubite.entity.Gift;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

import java.util.List;

public interface GiftJpa extends JpaRepository<Gift,Integer> {

    @Query(value = "select * from gift where spot_id = :spotId and task_total = :taskTotal",nativeQuery = true)
    List<Gift> giftBySpotIdAndTaskTotal(@Param("spotId")Integer spotId,@Param("taskTotal")Integer taskTotal);

    @Query(value = "select * from gift where spot_id = :spotId and task_total = :taskTotal",nativeQuery = true)
    Gift findBySpotIdAndTaskCount(@Param("spotId")Integer spotId,@Param("taskTotal")Integer taskTotal);
}
